<?php
/**
 * Created by PhpStorm.
 * User: ybjaa
 * Date: 2017/5/8
 * Time: 11:15
 */

namespace App\Business\Menu;


use App\Business\BusBase;
use App\Business\ReturnResult;
use App\Models\menus_manage;
use Illuminate\Support\Facades\DB;

class UpdateMenu extends MenusBase
{

    public $ID;
    public $menuName;
    public $menuURL;
    public $isDelete;
    public $isWrite;


    protected function Handle()
    {
        return $this->UpdateMenu();
    }

    public function GetBusinessName()
    {
        return "修改菜单";
    }


    protected function UpdateMenu()
    {
        //1检测字段是否为空
        if(!$this->CheckFiledsIsNotNull($this->menuName)||!$this->CheckFiledsIsNotNull($this->ID))
            return ReturnResult::Error(null,"名称无效");


        $menu=menus_manage::find($this->ID);
        if(!$menu) return ReturnResult::Error(null,"参数无效");

        $menu->menuName=$this->menuName;
        $menu->menuURL=$this->menuURL;
        $menu->isDelete=$this->isDelete;
        $menu->isWrite=$this->isWrite;

        $menu->save();

        return ReturnResult::Success();











    }


}